package com.hongyuan.sellfitness.ui.message.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.message.activity.MsgPraiseDetailActivity;
import com.hongyuan.sellfitness.ui.message.beans.MessagePraiseBean;


public class MessagePraiseItemViewModel extends ItemViewModel<MessagePraiseViewModel> {

    public ObservableField<MessagePraiseBean.ListBean> entity = new ObservableField<>();

    public MessagePraiseItemViewModel(@NonNull MessagePraiseViewModel viewModel, MessagePraiseBean.ListBean bean) {
        super(viewModel);
        entity.set(bean);
    }

    public int getPosition() {
        return viewModel.getItemPosition(this);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("circle_id",String.valueOf(entity.get().getCircle_id()));
            viewModel.startActivity(MsgPraiseDetailActivity.class,bundle);
        }
    });
}
